package lec15dfs;

import java.util.Arrays;
import java.util.Scanner;

public class A1 {
    public static void main(String[] args) {
        while (cin.hasNext()) {
            int[] a = new int[4];
            for (int i = 0; i < a.length; i++) {
                a[i] = cin.nextInt();
            }
            Arrays.sort(a);
            System.out.println((a[2] * 100 + a[1] * 10 + a[0]) * a[3]);
        }
    }

    static Scanner cin = new Scanner(System.in);
}